package model;

/**
 * @author  Owner
 */
public class SorterFactory {
	private static SorterFactory sorterFactory;

	private SorterFactory() {
	}

	public static SorterFactory getInstance() {
		if (sorterFactory == null) {
			sorterFactory = new SorterFactory();
			return sorterFactory;
		} else {
			return sorterFactory;
		}
	}

	public Sorter getSorter(Sorters sorters) {
		switch (sorters) {
		case bubble: {
			return new BubbleSort();
		}
		case quick: {
			return new QuickSort();
		}
		case selection: {
			return new SelectionSort();
		}
		case heap: {
			return new HeapSort();
		}
		case insertion: {
			return new InsertionSort();
		}
		case shell: {
			return new ShellSort();
		}
		case merge: {
			return new MergeSort();
		}
		
		default: {
			break;
		}
		}
		return null;

	}
}
